package com.cloud.lan.api;

import com.cloud.lan.api.dto.req.BaseReq;
import com.cloud.lan.api.dto.req.LanGoodsEvaluateReq;
import com.cloud.lan.entity.base.BaseResponse;
import com.cloud.lan.service.ILanGoodsEvaluateService;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import lombok.extern.slf4j.Slf4j;

/**
 * 商品评价 入口
 * @author ErKang
 * @date Created in 2021/12/5 04:24
 * @title TestApi.java
 * Department: Product development
 */
@Slf4j
@RestController
@RequestMapping(value = {"/v1/goods/evaluate/"}, method = {RequestMethod.GET, RequestMethod.POST}, consumes = {"*/*"}, produces = {"application" +
        "/json"})
public class LanGoodsEvaluateApi {

    @Resource
    ILanGoodsEvaluateService lanGoodsEvaluateService;

    @RequestMapping("getGoodsEvaluate")
    public BaseResponse<Object> getGoodsEvaluate(@RequestHeader(BaseReq.ut) String token, @RequestBody LanGoodsEvaluateReq req) {
        req.setToken(token);
        return lanGoodsEvaluateService.getGoodsEvaluate(req);
    }

    @RequestMapping("addEvaluate")
    public BaseResponse<Object> addEvaluate(@RequestHeader(BaseReq.ut) String token, @RequestBody LanGoodsEvaluateReq req) {
        req.setToken(token);
        return lanGoodsEvaluateService.addEvaluate(req);
    }

}
